Computer systems typically have some form of nonvolatile mass storage device. The computer's operating system is responsible for communicating with the mass storage device in order to create, delete, modify, or append files stored within the mass storage device. Data is stored on the disk by writing to a file within the mass storage device.
An electromechanical hard drive is one type of nonvolatile mass storage device often used by computer systems. Electromechanical hard drives have one or more circular platters or disks. These circular platters include a magnetic storage media for storing data. The platters are divided into concentric circles called tracks. The platters are also divided radially such that the tracks are subdivided into sectors. Thus a platter has a plurality of tracks, wherein each track has a plurality of sectors.
Each sector has a predetermined sector number for reference by the computer system. A file stored in an electromechanical hard drive might occupy a number of sectors. The sectors (i.e., file sectors) associated with the file can be located on one or more platters such that the associated sectors are not necessarily consecutively numbered nor are the sectors necessarily contiguously located to each other. Once a file is created, new data can be stored by appending the new data to the file. This typically results in the expansion of the size of the file by allocating additional sectors to the file.
Some applications only need to modify a pre-existing file rather than appending to the pre-existing file. For example, consider an application which only requires storage of a "window" of data. At any one time only a fixed amount of data must be stored. Instead of continuously appending new data to the file and thus expanding the storage requirements for the file, portions of the file are overwritten with the current window of data. Thus, for example, once sufficient file space is allocated on an electromechanical hard drive to account for the window of data, the file or portions of the file may be continuously overwritten with incoming data so that the file or some portion of the file represents the current window of data. The new version of a sector of data is used to overwrite an older version of the data stored in the same sector. This technique is particularly useful if the electromechanical hard drive is substantially full of data.
Solid state disks provide a mass storage alternative to the electromechanical hard drives. Solid state disks generally use nonvolatile semiconductor memories to provide mass storage. In order to maintain compatibility with electromechanical hard drives, however, solid state disks typically support the same sector-based file storage scheme so that a computer system can refer to numbered sectors in order to store or retrieve data from the solid state disk.
In contrast with an electromechanical hard drive, the nonvolatile memory of a solid state disk typically must be erased before they can be reprogrammed. Thus in order to change the data stored in a portion of the memory, that portion of the memory must be erased first. For some nonvolatile memories, however, erasure can take a relatively long period of time.
In order to achieve solid state disk performance on par with that of an electromechanical hard drive, one technique for updating a file sector writes a new version of the sector to another location within the nonvolatile memory. One disadvantage of writing sectors to different locations within the nonvolatile memory is that a sector map may be required to track the location of the current version of the sector. The sector map will need to be updated every time a sector is relocated.
The old versions are eventually erased in a background cleanup process in order to free up storage space. The background cleanup process permits deferring erasure until some point at which the erasure will not adversely affect the effective programming or write time for the nonvolatile memory.
The deferred erasure process may be suitable for some applications such as intermittent data transfers to the solid state disk, however, the deferred erasure process described above may be unsuitable for a file that is being continuously overwritten. In particular, if the background cleanup process is deferred long enough, a foreground cleanup process will have to be executed in order to free up additional space in the nonvolatile memory.
While the foreground cleanup process is executing, the incoming data must be temporarily stored elsewhere or ignored. Ignoring the data results in loss of the data, which should be avoided. Providing for a relatively large amount of temporary storage tends to increase the cost and size of the solid state drive. Furthermore, insufficient temporary storage can result in loss of data once the temporary storage is exceeded.
A method for permitting continuous overwrite of a file stored in a nonvolatile memory is needed.